/************打开页面**********/
//打开咨询列表
mui("header").on('tap','svg.icon.liebiao',function(){
	mui.openWindow({
		url:'lawList.html',
	    id:'lawList.html',
	});
})
//打开咨询查询
mui("header").on('tap','svg.icon.chaxun',function(){
	mui.openWindow({
		url:'lawQuery.html',
	    id:'lawQuery.html',
	});
})
/************打开页面end**********/

/************提交数据**********/
$('.lawMain .mui-input-row').on('click',function(){
	if($('#isopened').prop('checked')){
		$('#isopened').val(1)
	}else{
		$('#isopened').val(0)
	}
})
mui('.lawMain').on('tap','.submitzx',function(){
	var uid=null
	if(!uid){
		var username=$('#username').val()
		var phone=$('#phone').val()
		var content=$('#content').val()
		var isopened=$('#isopened').val()
	}else{
		var content=$('#content').val()
		var isopened=$('#isopened').val()
	}
	if(!username){
		outLine('请输入用户名')
		return false
	}
	var myreg=/^[1][3,4,5,7,8][0-9]{9}$/
	if(!phone||!myreg.test(phone)){
		outLine('手机号码有误')
		return false
	}
	if(!content){
		outLine('内容不能为空')
		return false
	}
	var uplawdata={
		title:"提交法律咨询",
		url:"index/savelaw",
		fromwho:'lj',
		sendData:{
			user:username,
			phone:phone,
			question:4,//咨询类型
			question_info:content,
			is_open:isopened,
			type:'add',
		}
	}
	upAjax(uplawdata,
		function(data){
			if(data.result==1){
				mui.toast('上传成功,1s后自动跳转')
				setTimeout("window.location.href='lawList.html'", 1000)
			}
		},
		function(data){
			alert(data)
		}
	)
})
/************提交数据end**********/